package com.bailian.spring.ioc.assembly_02.condition;

import com.bailian.spring.ioc.assembly_02.bean.Boos;
import org.springframework.context.annotation.Condition;
import org.springframework.context.annotation.ConditionContext;
import org.springframework.core.type.AnnotatedTypeMetadata;

/**
 * @author gaoxu
 * date: Created on 2021/11/2 下午3:40
 */
public class ExistBossCondition implements Condition {
    @Override
    public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) {
        return context.getBeanFactory().containsBeanDefinition(Boos.class.getName());
    }
}
